<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>浏览器任务管理器测试</title>
  </head>
  <body>
    <button id="btn">增加 JavaScript 内存</button>
    <button id="btn2">增加 DOM</button>
    <button id="stop">stop</button>

    <script>
      const oBtn = document.querySelector("#btn");
      const oBtn2 = document.querySelector("#btn2");
      const oBody = document.querySelector("body");
      const oStop = document.querySelector("#stop");
      let timer = null;

      oBtn.onclick = function () {
        let arrayList = new Array(100000);
      };

      oBtn2.onclick = function () {
        timer = setInterval(() => {
          const oDiv = document.createElement("div");
          oDiv.innerHTML = "1";
          oBody.appendChild(oDiv);
        }, 1000);
      };

      oStop.onclick = function () {
        clearInterval(timer);
      };
    </script>
  </body>
</html>
